About - 

A good example on how sockets work and how you can code it using Java language.

Steps- 

1) Compile both the files - 
javac ServerProgram.java ClientProgram.java

2) Run the ServerProgram.java first to start the server
java ServerProgram

3) Run the ClientProgram.java now to connect to the server
java ClientProgram

4) Start the messaging like shown in the image attached.